import { createApp } from 'vue'
import { createPinia } from 'pinia'
import App from './App.vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import router from "./router/index.js";
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import './less/reset.less'
import piniaPluginPersistedState from 'pinia-plugin-persistedstate'//pinia持久化插件
import {lazyPlugin} from "@/directives/index.js";//图片懒加载指令插件
import Region from 'v-region'//行政区划选择器组件
// 引入echarts
import Echarts from 'vue-echarts'
import * as echarts from 'echarts'


const app = createApp(App)
const pinia = createPinia()
pinia.use(piniaPluginPersistedState)

app.use(router)
app.use(pinia)
app.use(lazyPlugin)
app.use(ElementPlus,{
    locale:zhCn,
})
app.use(Region)
app.component('e-charts',Echarts)
// 全局挂载 echarts
app.config.globalProperties.$echarts = echarts
app.mount('#app')

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}